<%@ include file="/WEB-INF/jsp/includes.jsp" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8"  %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>浙江孵化器在线后台管理系统---通讯录管理---组列表</title>
    <link href="<spring:url value="/static/style/index.css" htmlEscape="true" />" rel="stylesheet" type="text/css">
</head>
<body>
<div class="list_right_title">
    <span><img src="<spring:url value="/static/images/infor_enter_icon.jpg" htmlEscape="true" />" alt="组列表"></span>通讯录管理>组列表
</div>
<div class="list_right_table_title">
     <form:form method="post" action="listContactGroups" name="multiplyActionForm"
                   id="multiplyActionForm">
       <div class="list_right_table_title_form">
            <input type="hidden" name="selectedGroupIDArray" id="selectedGroupIDArray"/>
            <input type="submit" value="  删除  " onclick="return checkSelectedGroups(this.form)"/>
            <input type="button" value="　添加　" onclick="window.location.href='manageContactGroup'">
            组名： <input type="text" name="searchKeyName">
            <input type="submit" value="　查询　"/>
       </div>
       <%@ include file="/WEB-INF/jsp/management/common/pagebar.jsp" %>
    </form:form>
</div>
<div class="table_box">
    <table class="table" cellspacing="0" cellpadding="0" summary="通讯录管理>组列表">
        <tr>
            <th nowrap width="5%" align="center">
                <input type="checkbox" id="fatherControlCB" onclick='selectAll()'/>
            </th>
            <th nowrap width="10%">组名</th>
            <th nowrap width="20%" >备注</th>
            <th nowrap width="35%" >添加时间</th>
            <th nowrap width="35%" style="border-right:#ffffff 1px solid;">操作</th>
        </tr>
        <c:forEach var="contactGroup" items="${page.result}">
            <tr>
                <td align="center" nowrap><input name="groupIndex" type="checkbox" value="${contactGroup.id}"/></td>
                <td align="center" nowrap>${contactGroup.name}&nbsp;</td>
                <td align="center" nowrap>${contactGroup.description}&nbsp;</td>
                <td nowrap align="center"><fmt:formatDate value="${contactGroup.createDatetime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                <td align="center" nowrap>
                    <div class="image">
                        <a href="listContactMemberByGroupID?contactGroupID=${contactGroup.id}">查看组用户</a>
                        <a href="manageContactGroup?contactGroupID=${contactGroup.id}">编辑</a>
                    </div>
                </td>
            </tr>
        </c:forEach>
    </table>
</div>
<%--<div class="list_right_table_title">
    <%@ include file="/WEB-INF/jsp/management/common/pagebar.jsp" %>
</div>--%>
<div class="list_right_table_title">
    <form:form method="post" action="listContactGroups" name="multiplyActionForm2"
                   id="multiplyActionForm2">
        <div class="list_right_table_title_form">
            <input type="hidden" name="selectedGroupIDArray" id="selectedGroupIDArray2"/>
                <input type="submit" value="  删除1  " onclick="return checkSelectedGroups(this.form)"/>
                <input type="button" value="　添加　" onclick="window.location.href='manageContactGroup'">
                组名： <input type="text" name="searchKeyName">
                <input type="submit" value="　查询　"/>
        </div>
        <%@ include file="/WEB-INF/jsp/management/common/pagebar.jsp" %>
    </form:form>
    </div>
    </body>
    <script type="text/javascript">
        function getSelectedGroups() {
            var allSelectedGroups = new Array();
            var allChkBoxes = document.getElementsByName("groupIndex");
            if (allChkBoxes != null)
                for (var i = 0,j = 0; i < allChkBoxes.length; i++) {
                    if (allChkBoxes[i].checked == true)
                        allSelectedGroups[j++] = allChkBoxes[i].value;
                }
            return  allSelectedGroups;
        }

        function checkSelectedGroups(formObj) {
            var selectedGroups = getSelectedGroups();
            if (selectedGroups == null || selectedGroups.length < 1) {
                alert("请选择组！");
                return false;
            } else {
                var result = window.confirm("你确信要删除所有选中项么?")
                if (!result) {
                    return false
                }
                formObj.action = "deleteManageGroups";
                document.getElementById("selectedGroupIDArray").value = selectedGroups;
                document.getElementById("selectedGroupIDArray2").value = selectedGroups;
                return true;
            }
        }

    function selectAll() {
        var allChkBoxes = document.getElementsByName("groupIndex");
        if (document.getElementById("fatherControlCB").checked) {
            for (var i = 0,j = 0; i < allChkBoxes.length; i++) {
                if (allChkBoxes[i].checked == false) {
                    allChkBoxes[i].checked = true;
                }
            }
        }
        else {
            for (var i = 0,j = 0; i < allChkBoxes.length; i++) {
                if (allChkBoxes[i].checked == true) {
                    allChkBoxes[i].checked = false;
                }
            }
        }
    }
</script>

</html>